/*************************************************************************
	> File Name: handset.h
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年12月07日 星期二 21时59分52秒
 ************************************************************************/

#include<iostream>
#include <string>

//手机软件抽象类
class HandsetSoft
{
public:
	virtual void run() = 0;
};

//手机软件具体类
class HandsetGame : public HandsetSoft
{
public:
	virtual void run()
	{
		std::cout << "运行手机游戏" << std::endl;
	}
};

class HandsetAddressList : public HandsetSoft
{
public:
	virtual void run()
	{
		std::cout << "运行手机通讯录" << std::endl;
	}
};

//手机品牌抽象类
class HandsetBrand
{
public:
	HandsetBrand(HandsetSoft* s) : soft(s) {}
	virtual ~HandsetBrand()
	{
		delete soft;
	}

	void setSoft(HandsetSoft* s)
	{
		this->soft = s;
	}

	virtual void run() = 0;

protected:
	HandsetSoft* soft;
};

//手机品牌具体类
class HandsetBrandN : public HandsetBrand
{
public:
	using HandsetBrand::HandsetBrand;
	virtual void run()
	{
		soft->run();
	}
};

class HandsetBrandM : public HandsetBrand
{
public:
	using HandsetBrand::HandsetBrand;
	virtual void run()
	{
		soft->run();
	}
};
